begintownscript;
variables;
short choice,i;
body;

beginstate init_state;
set_crime_tolerance(3);
	if((get_flag(0,13) == 1) && (get_flag(1,3) == 0))
		activate_hidden_group(1);
set_char_dialogue_pic(7,1948,0);
set_name(8,"Kryll");
set_name(9,"Tuchin");
set_name(10,"Journeyman Leon");
set_name(14,"Professor Aeron");
break;

beginstate exit_state;
break;

beginstate start_state;
if(get_flag(250,11) == 1)
{	message_dialog("The murder report contradicts Janok's account of the murder. The report claims both were killed by magical energy, and also claims that Dilecia and the soldier were a couple.","The truth can only be discovered by confronting Janok, hopefully you'll have a chance to do that. He will have to be stopped if you're to save Keilan.");
	set_flag(250,11,2);
}
break;

beginstate 10;
	move_to_new_town(0,19,13);
break;

beginstate 11;
	move_to_new_town(0,37,37);
break;

beginstate 12;
	move_to_new_town(0,34,29);
break;
beginstate 13;
	if(get_flag(1,1) == 0) {
	message_dialog("You enter the mayor's bedroom. The room is lavishly furnished with rich tapestries hanging from the walls, and gold inlay adorns the wood of the four-poster bed that dominates the room.","");
	set_flag(1,1,1);
}
break;
beginstate 14;
	if(get_flag(1,2) == 0) {
	message_dialog("This library is clearly intended for the students of the Academy. Books about magical theory, alchemy, and even mathematics fill the shelves. The heavy panels on the wooden walls absorb all sound, so students can study in silence.","");
	set_flag(1,2,1);
}
break;
beginstate 15;
	message_dialog("On the other side of this room are the classrooms. Classes are currently in session; your interuptions would not be welcome here.","");
break;
beginstate 16;
	if(get_flag(1,7) == 0) {
	message_dialog("This barracks-style room is where students of the Academy sleep. Most of the older students live in houses in Keilan or outlying villages, so there are relatively few beds here.","");
	set_flag(1,7,1);
}
break;
beginstate 17;
	if(get_flag(1,9) == 0) {
	message_dialog("The room here overlooks the fountain hall in the floor below. It is set up as a recreation room for students, with tables along the wall to allow reading, conversation, and board games.","");
	set_flag(1,9,1);
}
break;
beginstate 18;
	if(get_flag(1,3) == 0) {
		block_entry(1);
		message_dialog("This door is locked with a seemingly regular lock, but when you attempt to put your lockpicks inside, you receive a strong magical shock. You won't be able to get in here.","");
}
break;

beginstate 19;
	if(get_flag(1,8) == 0) {
	message_dialog("The bank is fairly simple. There is a table against either wall for conferences with clients. The northern wall is lined with neatly organized bookshelves, presumably filled with ledgers and accounts of the bank's assets.","You would be remiss as a long-time adventurer if you didn't also notice the large iron gates to the north. You would bet anything that they led to the bank vaults. The prospect makes your mouths water, but you see no way to open them.");
	set_flag(1,8,1);
}
break;

beginstate 20;
	move_to_new_town(0,12,30);
break;

beginstate 21;
	if((get_flag(0,13) == 1) && (get_flag(1,3) == 0)) {
		block_entry(1);
		text_bubble_on_char(9,"Come, adventurers.");
		force_view_center(char_loc_x(9),char_loc_y(9));
		force_instant_terrain_redraw();
		pause(10);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"It is time I show you");
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"the defense of our city.");
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(9,"");
		set_terrain(30,6,15);
		set_character_facing(9,6);
		text_bubble_on_char(9,"This way");
		force_instant_terrain_redraw();
		pause(2);

		relocate_character(9,30,6);
		march_party(27,6);
		force_instant_terrain_redraw();
		force_view_center(char_loc_x(9),char_loc_y(9));
		pause(6);

		text_bubble_on_char(9,"");
		set_character_facing(9,4);
		relocate_character(9,30,7);
		march_party(28,6);
		force_instant_terrain_redraw();
		force_view_center(char_loc_x(9),char_loc_y(9));
		pause(6);

		relocate_character(9,30,8);
		march_party(29,6);
		force_instant_terrain_redraw();
		force_view_center(char_loc_x(9),char_loc_y(9));
		pause(6);

		relocate_character(9,30,9);
		march_party(30,6);
		force_instant_terrain_redraw();
		force_view_center(char_loc_x(9),char_loc_y(9));
		pause(6);

		relocate_character(9,30,10);
		march_party(30,7);
		force_instant_terrain_redraw();
		force_view_center(char_loc_x(9),char_loc_y(9));
		pause(6);

		relocate_character(9,30,11);
		march_party(30,8);
		force_instant_terrain_redraw();
		force_view_center(char_loc_x(9),char_loc_y(9));
		pause(6);

		relocate_character(9,30,12);
		march_party(30,9);
		force_instant_terrain_redraw();
		force_view_center(char_loc_x(9),char_loc_y(9));
		pause(6);

		relocate_character(9,30,13);
		march_party(30,10);
		force_instant_terrain_redraw();
		force_view_center(char_loc_x(9),char_loc_y(9));
		pause(6);

		relocate_character(9,30,14);
		march_party(30,11);
		force_instant_terrain_redraw();
		force_view_center(char_loc_x(9),char_loc_y(9));
		pause(6);

		relocate_character(9,30,15);
		march_party(30,12);
		force_instant_terrain_redraw();
		force_view_center(char_loc_x(9),char_loc_y(9));
		pause(6);

		relocate_character(9,30,16);
		march_party(30,13);
		force_instant_terrain_redraw();
		force_view_center(char_loc_x(9),char_loc_y(9));
		pause(6);

		relocate_character(9,30,17);
		march_party(30,14);
		force_instant_terrain_redraw();
		force_view_center(char_loc_x(9),char_loc_y(9));
		pause(6);

		relocate_character(9,31,18);
		march_party(30,15);
		set_character_facing(9,6);
		force_instant_terrain_redraw();
		pause(6);

		march_party(30,16);
		force_instant_terrain_redraw();
		pause(6);

		march_party(30,17);
		force_instant_terrain_redraw();
		pause(6);

		text_bubble_on_char(9,"*click*");
		set_terrain(31,18,17);
		force_instant_terrain_redraw();
		pause(3);

		text_bubble_on_char(9,"");
		relocate_character(9,32,18);
		march_party(31,18);
		force_instant_terrain_redraw();
		force_view_center(char_loc_x(9),char_loc_y(9));
		pause(6);

		relocate_character(9,33,18);
		march_party(32,17);
		force_instant_terrain_redraw();
		force_view_center(char_loc_x(9),char_loc_y(9));
		pause(6);

		set_character_facing(9,2);
		march_party(32,18);
		force_instant_terrain_redraw();
		pause(6);

		march_party(32,19);
		force_instant_terrain_redraw();
		pause(6);
		
		march_party(32,20);
		force_instant_terrain_redraw();
		pause(6);

		i = 0;
		while(i <= 5) {
			set_character_facing(i,6);
			i = i + 1; }
		force_instant_terrain_redraw();
		pause(5);

		i = 0;
		while(char_ok(i) == 0)
			{ i = i + 1; } 
		text_bubble_on_char(i,"What is all this?");
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(i,"");
		text_bubble_on_char(9,"This chamber houses");
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"a disruption crystal.");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"This is what keeps the golems at bay.");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(i,"How does it work?");
		text_bubble_on_char(9,"");
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(i,"");
		text_bubble_on_char(9,"Allow me to explain");
		force_instant_terrain_redraw();
		pause(15);

		message_dialog("_It operates on the same principles as an antimagic cloud, only not so strong. Disruption fields are often placed over magic schools to prevent experiments or uncontrolled spells from getting out of hand._","_An antimagic could allows no magic to be cast, a disruption field merely makes spells fade much more rapidly, especially if uncontrolled. I'm sure that any spell casters in your group will have felt its effect._");

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"You see why this would be useful");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"around many untrained apprentices.");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"A spell that might destroy the school");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"would only singe a few eyebrows.");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"But more importantly at the moment,");
		force_instant_terrain_redraw();
		pause(22);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"this field interferes with golems.");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"It unravels the magic that holds them,");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"and destroys them within minutes.");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(9,"");
		text_bubble_on_char(i,"So Keilan is safe!");
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(i,"");
		text_bubble_on_char(9,"We had hoped so,");
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"but it seems that this rogue wizard");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"knows what he's about.");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"The strength of the field is limited;");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"his experiments are getting closer;");
		force_instant_terrain_redraw();
		pause(20);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"he will find a way around it soon.");
		force_instant_terrain_redraw();
		pause(22);

		text_bubble_on_char(9,"");
		text_bubble_on_char(9,"And then our destruction is at hand.....");
		force_instant_terrain_redraw();
		pause(30);

		text_bubble_on_char(9,"");
		text_bubble_on_char(i,"Give us the crystal,");
		force_instant_terrain_redraw();
		pause(15);

		text_bubble_on_char(i,"");
		text_bubble_on_char(i,"with it, no golem could touch us.");
		force_instant_terrain_redraw();
		pause(20);

		message_dialog("He sighs, _I'm afraid it doesn't work that way. You see all this machinery? This is what really controls and feeds the field. A portable disruption crystal would only have a several yard radius at best._","He thinks for several moments, then gets excited. _Hand me one of those books you took._ You do so. He looks over it mumbling, _If you redirected the exhaust conduit for greater output, and disabled the broadcasting unit. Yes! I think this could work!_");
		message_dialog("You ask him what he's talking about, Tuchin is so excited he can hardly contain himself. _We could use his own machinery against him! The power source used to communicate with the golems is almost identical to the one we use for the crystal!_","_If you plug the disruption crystal into the machinery at his headquarters, then every golem in the factory would be destroyed! I'll just have to give you instructions so you can handle the minor differences._");

		text_bubble_on_char(i,"");
		text_bubble_on_char(9,"It's brilliant!");
		set_character_facing(9,6);
		force_instant_terrain_redraw();
		pause(5);
		
		set_character_pose(9,2);
		force_instant_terrain_redraw();
		pause(5);

		text_bubble_on_char(9,"");
		set_terrain(35,17,388);
		set_terrain(35,19,388);
		force_instant_terrain_redraw();
		play_sound(7);
		pause(10);

		text_bubble_on_char(9,"");
		set_terrain(39,17,388);
		set_terrain(39,19,388);
		force_instant_terrain_redraw();
		play_sound(7);
		pause(10);

		set_character_pose(9,0);
		force_instant_terrain_redraw();
		pause(4);

		relocate_character(9,34,19);
		force_instant_terrain_redraw();
		pause(6);

		relocate_character(9,35,20);
		force_instant_terrain_redraw();
		pause(6);

		set_character_facing(9,0);
		relocate_character(9,36,19);
		force_instant_terrain_redraw();
		pause(6);

		relocate_character(9,36,18);
		force_instant_terrain_redraw();
		pause(6);

		set_character_facing(9,6);
		set_character_pose(9,2);
		force_instant_terrain_redraw();
		pause(5);

		move_item_on_spot(37,18,-1,1);

		text_bubble_on_char(9,"I'll speak with you downstairs.");
 		set_character_pose(9,0);
		set_character_facing(9,2);
		force_instant_terrain_redraw();
		pause(20);

		put_boom_on_char(9,2,0);
		run_animation_sound(10);
		erase_char(9);
		force_instant_terrain_redraw();
		pause(5);

		set_flag(1,3,1);
}
break;

beginstate 22;
	message_dialog("You lean over the apprentice's shoulder to see what he's reading. He looks up, perturbed, and requests in no uncertain terms that you make yourselves scarce.","You are all to happy to oblige, your glance revealed that the student was reading _A Study in the Laws of Antimagic Fields._ Not your idea of a good time.");
break;

beginstate 23;
if(get_flag(250,8) == 0)
	message_dialog("The book is an unabridged history of the Academy, complete with lists of every student ever enrolled there, a list of all professors and Masters, and an account of any other incident deemed important. You don't have any reason to read this.","");
if(get_flag(250,8) > 0)
{	reset_dialog();
	add_dialog_str(0,"The book is an unabridged history of the Academy, complete with lists of every student ever enrolled there, a list of all professors and Masters, and an account of any other incident deemed important.",0);
	add_dialog_str(1,"You would be shocked if somewhere in this massive tome Janok isn't mentioned. Should you take the time to search through it?",0);
	add_dialog_choice(0,"Search it.");
	add_dialog_choice(1,"Leave it.");
	choice = run_dialog(1);
	if(choice == 1)
	{	reset_dialog();
		add_dialog_str(0,"It isn't too hard to find Janok since you know when he was enrolled. There isn't much mentioned in the log of students enrolled that year, but there is an entire chapter devoted to him under the important events of that year.",0);
		add_dialog_str(1,"The section details the investigation into a killing that year. An Empire soldier and a young girl were murdered. Interviews with the girl's family revealed they were a couple, and had been going out for several months.",0);
		add_dialog_str(2,"The two were found dead on May Day of that year. Both were scorched with magical energy. Also, a young man named Janok went missing on this day.",0);
		add_dialog_str(3,"It was originally assumed that some mage had killed the three youths, and no one had any idea who it might be. However, a witness claimed he heard a scream and left his house to see a man in the robes of an apprentice fleeing the scene.",0);
		add_dialog_str(4,"Janok was the new suspect, and a manhunt began to find him. The writers of the article go on to discuss the repercussions this incident would have on the Academy's image, but does mention that the case wasn't ever resolved.",0);
		add_dialog_choice(0,"OK");
		choice = run_dialog(1);
		if(choice == 1)
		{	set_flag(250,11,1);
			end(); }
}
	if(choice == 2)
		end();
}
break;

		